package com.imu.utils;
import java.util.zip.CRC32;

import com.xiaoleilu.hutool.date.SystemClock;

/**
 * 设备唯一id转数字的CRC32校验码算法实现
 * @author sunhongwei
 * @email sunhongwei@jshijian.com
 * @date 2017-12-22 13:45:21
 */
public class DeviceIdUtil 
{
	/**
	 * @author eaves.zhu
	 * @param deviceId
	 * @return int 
	 * CRC32
	 */
	public static long getCRC32(String deviceId)
	{
        CRC32 crc32 = new CRC32();  
        crc32.update(deviceId.getBytes());
        return crc32.getValue();
	}
	
	public static void main(String[] args) throws InterruptedException 
	{
		for (int i = 0; i < 100; i++) 
		{
			System.out.println(getCRC32(String.valueOf(SystemClock.now())));
			Thread.sleep(1);
		}
	}
}